import { selectAddressInfo, selectAddressInfoById, insertAddress, updateAddress, deleteAddress } from '../service/address.js';

/* 获取地址信息 */
let getAddress = async (ctx, next) => {
  selectAddressInfo(ctx, next);
};

/* 根据id获取地址信息 */
let getAddressById = async (ctx, next) => {
  selectAddressInfoById(ctx, next);
};
/* 保存地址信息 */
let saveAddress = async (ctx, next) => {
  insertAddress(ctx, next);
};

/* 保存地址信息 */
let putAddress = async (ctx, next) => {
  updateAddress(ctx, next);
};

/* 保存地址信息 */
let delAddress = async (ctx, next) => {
  deleteAddress(ctx, next);
};

/* 注意请求方式后面的空格 */
export default {
  'GET /shippingAddress': getAddress,
  'GET /shippingAddress/:id': getAddressById,
  'POST /shippingAddress': saveAddress,
  'PUT /shippingAddress/:id': putAddress,
  'DELETE /shippingAddress/:id': delAddress,
};